package driver;

import java.sql.*;

public class Driver {
    public static void main(String[] agrs){
        try {
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("驱动加载成功！");
            String url="jdbc:mysql://localhost:3306";
            String user="root";
            String pwd="root";
            Connection con= DriverManager.getConnection(url,user,pwd);
            System.out.println("连接成功！");
            Statement stm=con.createStatement();//调用Statement方法
            String sql1="Select * from userInfo";
            ResultSet rs=stm.executeQuery(sql1);

        } catch (ClassNotFoundException e) {
            System.out.println("找不到驱动！");
        }catch (SQLException e){
            System.out.println(e.getMessage());
        }
    }
}
